package com.paireach.szwolaiyun.util;

/**
 * Created by Administrator on 2016/6/24.
 */
public class DateUtil {
    public static boolean judge(int year)
    {
        boolean yearleap = (year % 400 == 0) || (year % 4 == 0) && (year % 100 != 0);//采用布尔数据计算判断是否能整除
        return yearleap;
    }

    public static int calculate(int year, int month)
    {
        boolean yearleap = judge(year);
        int day;
        if(yearleap && month == 2)
        {
            day = 29;
        }
        else if(!yearleap && month == 2)
        {
            day = 28;
        }
        else if(month == 4 || month == 6 || month == 9 || month == 11)
        {
            day = 30;
        }
        else
        {
            day = 31;
        }
        return day;
    }
}
